import Vue from 'vue';
import Router from 'vue-router';

Vue.use(Router);
// 解决报错
const originalPush = Router.prototype.push
const originalReplace = Router.prototype.replace
// push
Router.prototype.push = function push(location, onResolve, onReject) {
    if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject)
    return originalPush.call(this, location).catch(err => err)
}
// replace
Router.prototype.replace = function push(location, onResolve, onReject) {
    if (onResolve || onReject) return originalReplace.call(this, location, onResolve, onReject)
    return originalReplace.call(this, location).catch(err => err)
}

export default new Router({
    routes: [
        {
            path: '/',
            name: '首页',
            hidden: false,
            type: 'all',
            icon: 'el-icon-lx-home',
            redirect: '/dashboard'
        },
        {
            path: '/account',
            component: () => import('@/common/Home.vue'),
            name: '账号管理',
            hidden: false,
            type: 'root',
            icon: 'el-icon-notebook-2',
            children: [
                {
                    path: '/manageAccount',
                    // hidden: true,
                    name: '账号列表',
                    component: () => import('@/page/rootManage/manageAccount.vue'),
                },
                {
                    path: '/rootUser',
                    name: '用户列表',
                    type: 'root',
                    hidden: false,
                    component: () => import('@/page/rootManage/user.vue'),
                },
            ]
        },
        {
            path: '/schoolManage',
            component: () => import('@/common/Home.vue'),
            name: '校区管理',
            hidden: false,
            type: 'root',
            icon: 'el-icon-notebook-2',
            children: [
                {
                    path: '/schoolManage',
                    // hidden: true,
                    name: '校区列表',
                    component: () => import('@/page/rootManage/schoolManage.vue'),
                },
            ]
        },

        {
            path: '/curriculum',
            component: () => import('@/common/Home.vue'),
            name: '课程管理',
            hidden: false,
            type: 'root',
            icon: 'el-icon-notebook-2',
            children: [
                {
                    path: '/curriculumCategory',
                    // hidden: true,
                    name: '课程类型',
                    component: () => import('@/page/curriculumManage/curriculumCategory.vue'),
                },
                {
                    path: '/curriculumDetails',
                    hidden: true,
                    name: '课程详情',
                    component: () => import('@/page/curriculumManage/curriculumDetails.vue'),
                },
            ]
        },
        {
            path: '/curriculum',
            component: () => import('@/common/Home.vue'),
            name: '课程管理',
            hidden: false,
            type: 'school',
            icon: 'el-icon-notebook-2',
            children: [

                {
                    path: '/curriculumList',
                    // hidden: true,
                    name: '课程上架',
                    component: () => import('@/page/curriculumManage/curriculumList.vue'),
                },
                {
                    path: '/addCurriculum',
                    hidden: true,
                    name: '添加课程',
                    component: () => import('@/page/curriculumManage/addCurriculum.vue'),
                },
                {
                    path: '/editCurriculum',
                    hidden: true,
                    name: '修改课程',
                    component: () => import('@/page/curriculumManage/editCurriculum.vue'),
                },
                {
                    path: '/curriculumManage',
                    // hidden: true,
                    name: '排课管理',
                    component: () => import('@/page/curriculumManage/curriculumManage.vue'),
                },
                // {
                //     path: '/classScheduleCard',
                //     // hidden: true,
                //     name: '课表查看',
                //     component: () => import('@/page/curriculumManage/classScheduleCard.vue'),
                // },
                {
                    path: '/curriculumDetails',
                    hidden: true,
                    name: '课程详情',
                    component: () => import('@/page/curriculumManage/curriculumDetails.vue'),
                },
            ]
        },
        {
            path: '/order',
            component: () => import('@/common/Home.vue'),
            name: '订单管理',
            hidden: false,
            type: 'school',
            icon: 'el-icon-notebook-2',
            children: [
                {
                    path: '/Order',
                    // hidden: true,
                    name: '订单列表',
                    component: () => import('@/page/order/Order.vue'),
                },
                {
                    path: '/OrderDetails',
                    hidden: true,
                    name: '订单详情',
                    component: () => import('@/page/order/OrderDetails.vue'),
                },
            ]
        },
        {
            path: '/user',
            component: () => import('@/common/Home.vue'),
            name: '用户管理',
            type: 'school',
            hidden: false,
            icon: 'el-icon-user',
            children: [
                {
                    path: '/dashboard',
                    hidden: true,
                    name: '首页',
                    component: () => import('@/page/Dashboard.vue'),
                },
                {
                    path: '/user',
                    name: '用户列表',
                    type: 'school',
                    hidden: false,
                    component: () => import('@/page/user/user.vue'),
                },
                // {
                //     path: '/signUp',
                //     // hidden: true,
                //     type: 'school',
                //     name: '报名数据',
                //     component: () => import('@/page/user/signUp.vue'),
                // },
                {
                    path: '/userdetails',
                    name: '用户详情',
                    hidden: true,
                    component: () => import('@/page/user/userDetails.vue'),
                },
                {
                    path: '/passWord',
                    component: () => import('@/page/passWord.vue'),
                    hidden: true,
                    name: '修改密码'
                },

            ]
        },
        {
            path: '/teacher',
            component: () => import('@/common/Home.vue'),
            name: '教师管理',
            hidden: false,
            type: 'school',
            icon: 'el-icon-user',
            children: [
                {
                    path: '/teacherManageAccount',
                    // hidden: true,
                    name: '教师账号',
                    component: () => import('@/page/rootManage/teacherManageAccount.vue'),
                },
                // {
                //     path: '/teacheAttendance',
                //     // hidden: true,
                //     type: 'school',
                //     name: '教师考勤',
                //     component: () => import('@/page/teacherManage/teacheAttendance.vue'),
                // },
                // {
                //     path: '/teacheAttendanceDetails',
                //     hidden: true,
                //     name: '考勤详情',
                //     component: () => import('@/page/teacherManage/teacheAttendanceDetails.vue'),
                // },
                // {
                //     path: '/teacheRapprove',
                //     // hidden: true,
                //     type: 'school',
                //     name: '请假代课审批',
                //     component: () => import('@/page/teacherManage/teacheRapprove.vue'),
                // },
            ]
        },
        {
            path: '/leave',
            component: () => import('@/common/Home.vue'),
            name: '请假代课',
            hidden: false,
            type: 'school',
            icon: 'el-icon-notebook-2',
            children: [
                {
                    path: '/leaveList',
                    // hidden: true,
                    name: '请假列表',
                    component: () => import('@/page/leave/leaveList.vue'),
                },
                {
                    path: '/studentLeaveList',
                    // hidden: true,
                    name: '学生请假列表',
                    component: () => import('@/page/leave/studentLeaveList.vue'),
                },
                {
                    path: '/takeClassList',
                    // hidden: true,
                    name: '代课列表',
                    component: () => import('@/page/takeClass/takeClassList.vue'),
                },
            ]

        },
        {
            path: '/workRecord',
            component: () => import('@/common/Home.vue'),
            name: '工作记录',
            hidden: false,
            type: 'school',
            icon: 'el-icon-notebook-2',
            children: [
                {
                    path: '/beforeRecord',
                    // hidden: true,
                    name: '校内工作记录',
                    component: () => import('@/page/workRecord/beforeRecord.vue'),
                },
                {
                    path: '/recordFeedback',
                    name: '课后反馈',
                    component: () => import('@/page/workRecord/recordFeedback.vue'),
                },
                {
                    path: '/beforeRecordDetail',
                    hidden: true,
                    name: '校内工作详情',
                    component: () => import('@/page/workRecord/beforeRecordDetail.vue'),
                },
                {
                    path: '/recordFeedbackDetail',
                    hidden: true,
                    name: '课后反馈详情',
                    component: () => import('@/page/workRecord/recordFeedbackDetail.vue'),
                },
            ]
        },
        {
            path: '/attendance',
            component: () => import('@/common/Home.vue'),
            name: '考勤消课',
            hidden: false,
            type: 'school',
            icon: 'el-icon-notebook-2',
            children: [

                {
                    path: '/attendanceList',
                    name: '考勤记录',
                    component: () => import('@/page/attendance/attendanceList.vue'),
                },
                {
                    path: '/eliminationClass',
                    name: '消课统计',
                    component: () => import('@/page/attendance/eliminationClass.vue'),
                },
            ]
        },


        // {
        //     path: '/takeClass',
        //     component: () => import('@/common/Home.vue'),
        //     name: '代课管理',
        //     hidden: false,
        //     type: 'school',
        //     icon: 'el-icon-notebook-2',
        //     children: [
        //         {
        //             path: '/takeClassList',
        //             // hidden: true,
        //             name: '代课列表',
        //             component: () => import('@/page/takeClass/takeClassList.vue'),
        //         },
        //     ]
        // },
        // {
        //     path: '/Statistics',
        //     component: () => import('@/common/Home.vue'),
        //     name: '统计管理',
        //     hidden: false,
        //     type: 'school',
        //     icon: 'el-icon-notebook-2',
        //     children: [
        //         {
        //             path: '/StatisticsList',
        //             // hidden: true,
        //             name: '月度统计',
        //             component: () => import('@/page/Statistics/StatisticsList.vue'),
        //         },
        //     ]
        // },
        {
            path: '/setPhone',
            component: () => import('@/common/Home.vue'),
            name: '教务设置',
            hidden: false,
            type: 'school',
            icon: 'el-icon-user',
            children: [
                {
                    path: '/attendanceSet',
                    // hidden: true,
                    name: '考勤定位设置',
                    component: () => import('@/page/attendance/attendanceSet.vue'),
                },
                {
                    path: '/setPhone',
                    name: '教务手机号',
                    component: () => import('@/page/setPhone/setPhone.vue'),
                },
                {
                    path: '/customerQrcode',
                    name: '客服二维码',
                    component: () => import('@/page/customer/customerQrcode.vue'),
                },
                {
                    path: '/pushNotice',
                    name: '开课推送通知',
                    component: () => import('@/page/pushNotice/pushNotice.vue'),
                },
            ]
        },
        // {
        //     path: '/customer',
        //     component: () => import('@/common/Home.vue'),
        //     name: '客服管理',
        //     hidden: false,
        //     type: 'school',
        //     icon: 'el-icon-user',
        //     children: [
        //         {
        //             path: '/customerQrcode',
        //             name: '客服二维码',
        //             component: () => import('@/page/customer/customerQrcode.vue'),
        //         },
        //     ]
        // },
        {
            path: '/login',
            component: () => import('@/page/Login.vue'),
            hidden: true,
            name: '登录'
        },


        // {
        //     path: '*',
        //     hidden: true,
        //     redirect: '/404'
        // }
    ]
});
